/* eslint-disable */
const { override, addWebpackAlias, fixBabelImports, addWebpackPlugin } = require('customize-cra')
const path = require('path')
const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin')

if(process.env.NODE_ENV === 'production') {
  process.env.GENERATE_SOURCEMAP = "false"
}

function resolve(dir) {
  return path.join(__dirname, dir)
}

const addCustomize = () => (config) => {
  return config;
};

module.exports = override(

  fixBabelImports("import", {
    libraryName: "antd",
    libraryDirectory: "es",
    style: true, // 自动打包相关的样式
  }),

  // 配置路径别名
  addWebpackAlias({
    '@': resolve('src'),
  }),

  // 替换moment.js
  addWebpackPlugin(new AntdDayjsWebpackPlugin())
)
